package POJO;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

public class Node {
    // 节点唯一标识（对应"uuid"字段）
    @JsonProperty("uuid")
    private String uuid;

    @Override
    public String toString() {
        return "Node{" +
                "uuid='" + uuid + '\'' +
                ", pid='" + pid + '\'' +
                ", name='" + name + '\'' +
                ", pm=" + pm +
                ", type='" + type + '\'' +
                '}';
    }

    // 父节点ID（对应"pid"字段）
    @JsonProperty("pid")
    private String pid;

    public Node() {
    }

    // 节点名称（对应"name"字段）
    @JsonProperty("name")
    private String name;

    // 参数列表（对应"pm"数组）
    @JsonProperty("pm")
    private List<Pm> pm;

    public Node(String uuid, String pid, String name, List<Pm> pm, String type) {
        this.uuid = uuid;
        this.pid = pid;
        this.name = name;
        this.pm = pm;
        this.type = type;
    }

    public Node DeepCopy(Node node,List<Pm> pm){
        return new Node(node.uuid,node.pid,node.name,pm,node.type);
    }

    // 节点类型（对应"type"字段）
    @JsonProperty("type")
    private String type = "utBoard";

    // getter和setter
    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Pm> getPm() {
        return pm;
    }

    public void setPm(List<Pm> pm) {
        this.pm = pm;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Pm getPmListByIndex(int index){
        return pm.get(index);
    }
}